/**
 * 
 */
package com.sun.java.networking;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

/**
 * @author Jun
 *
 */
public class URLConnectionReader {

	/**
	 * @param args
	 */
	public static void main(String[] args)throws Exception {
		// TODO 自动生成方法存根

		 URL yahoo = new URL("http://www.yahoo.com/");
	        URLConnection yc = yahoo.openConnection();
	        BufferedReader in = new BufferedReader(
	                                new InputStreamReader(
	                                yc.getInputStream()));
	        String inputLine;

	        while ((inputLine = in.readLine()) != null) 
	            System.out.println(inputLine);
	        in.close();

	}

}
